// test
// interface fntype {
//     type: string
//     value: number | string
// }

// const typeFun = (type: string, value: string | number) => {
//     console.log(2);
//     console.log(type);
//     console.log(value);
// }

// typeFun('a', 'a is a string')

// const typeInterfaceFn = (props: fntype) => {
//     console.log(props)
// }

// typeInterfaceFn({type: 'b', value: 'b is a object type'})

import express from 'express';
import cors from 'cors';
import bodyParser from 'body-parser';
import logger from './logger';
import config from './config';
import trace from './routes/trace';
import connectToDB from './db';

connectToDB();
const app = express();
app.use(cors());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use('/get', trace);

app.get('/', (req: any, res: any) => {
  res.send('node-server: hello word!');
});

// @ts-ignore
app.listen(config.serverPort, () => { 
  console.log("\x1b[42;30m DONE \x1b[40;32m Compiled successfully \x1b[0m");
  console.log(`http://localhost:${config.serverPort}`)
});
